package com.hhsjdesign.dynamicui.utils

import java.lang.reflect.Constructor

object BusinessViewCreatorFactory {


    //创建ViewHolder
    fun makeViewHolder(dataType: String): BusinessViewCreator<*>? {
        val clazz =
            ClassCachePool.getClassByWidgetType(ClassCachePool.VIEW_HOLDER, dataType) ?: return null
        val constructor: Constructor<*> = clazz.getConstructor(String::class.java)
        return constructor.newInstance(dataType) as BusinessViewCreator<*>
    }

    @JvmStatic
    fun mapSize(): Int {
        return ClassCachePool.viewHolderSize()
    }
}